Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Namespace NVPortal.Modules.NVNews

    Public MustInherit Class OnlyTitle2
        Inherits Entities.Modules.PortalModuleBase

#Region "Controls"
#End Region

#Region "Event Handlers"
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                If Not IsPostBack Then
                    Dim arrNews2 As New ArrayList
                    Dim ctlNews2 As New NV_NewsController
                    arrNews2 = ctlNews2.SelectCustomeNews(IIf(Settings("NVNewsCategorySetting") <> "", Settings("NVNewsCategorySetting"), 0), PortalId, CInt(190) + 1)
                    Dim objNews As NV_NewsInfo
                    objNews = CType(arrNews2(0), NV_NewsInfo)
                    'Me.lbSummary.Text = objNews.Summary
                    Dim DisplayNumber As String
                    If Settings("NVNewsDisplayNumberSetting") <> "" Then
                        DisplayNumber = Settings("NVNewsDisplayNumberSetting")
                    Else
                        DisplayNumber = "1 1" ' 1 row and 1 col
                    End If
                    Dim iDisplay As Integer = 1
                    iDisplay = Split(DisplayNumber)(0) * Split(DisplayNumber)(1)
                    Me.drgOtherNews.RepeatColumns = Split(DisplayNumber)(1)

                    'Cac tin khac cung chuyen muc voi tin nay
                    Dim ds As ArrayList
                    Dim ctlNews As New NV_NewsController
                    ds = ctlNews.SelectCustomeNews(IIf(Settings("NVNewsCategorySetting") <> "", Settings("NVNewsCategorySetting"), 0), PortalId, iDisplay)
                    Me.drgOtherNews.DataSource = ds
                    Me.drgOtherNews.DataBind()
                End If
            Catch ex As Exception
                'Me.imgNews.Visible = False
                ' Exception
                ProcessModuleLoadException(Me, ex)
            End Try
        End Sub
        Public Function FormatURL(ByVal sitem As String, ByVal strID As String, ByVal scat As String, ByVal strCatID As String, ByVal strLink As String) As String
            Dim i As Integer
            If IsNumeric(Settings("NVNewsDisplayPageSetting")) Then
                i = Settings("NVNewsDisplayPageSetting")
                Return "/TabID/" & i & "/" & scat & "/" & strCatID & "/" & sitem & "/" & strID & "/" & strLink & ".aspx"
            Else
                Return "/TabID/75/" & scat & "/" & strCatID & "/" & sitem & "/" & strID & "/" & strLink & ".aspx"
            End If

            Return "/TabID/" & i & "/" & scat & "/" & strCatID & "/" & sitem & "/" & strID & "/" & strLink & ".aspx"
        End Function
        Public Function ReplaceChuoi(ByVal chuoi As String) As String
            Dim convert As String = Global.ReplaceChuoi.bodau(chuoi).Replace(" ", "-")
            Return convert
        End Function
        Function CheckImageNewVisible(ByVal CreateDate As Date) As Boolean
            If Now.Date < CreateDate.AddDays(2) Then
                Return True
            Else
                Return False
            End If
        End Function
        Public Function ImageWidth() As String
            Return IIf(Settings("NVNewsImageValueSetting") <> "", Split(Settings("NVNewsImageValueSetting"))(0), 60)
        End Function
#End Region

#Region "Optional Interfaces"

#End Region


    End Class

End Namespace
